package com.marvels.financial.task.tasklet;

import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.scope.context.ChunkContext;
import org.springframework.batch.core.step.tasklet.Tasklet;
import org.springframework.batch.repeat.RepeatStatus;
import org.springframework.beans.factory.annotation.Autowired;

import com.marvels.common.utils.MarvelsLogUtil;
import com.marvels.financial.loan.service.WithholdResultQueryTaskletApi;


/**
 * 定时代扣结果查询
 * @author tangpw
 *
 */
public class WithholdResultQueryTasklet implements Tasklet {

	@Autowired
	private WithholdResultQueryTaskletApi withholdResultQueryTaskletApi;

	@Override
	public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
		try{
			MarvelsLogUtil.getInstance().info(">>>>>>定时代扣结果查询任务开始");
			withholdResultQueryTaskletApi.withholdResultQuery();
			MarvelsLogUtil.getInstance().info(">>>>>>定时代扣结果查询任务结束");
		} catch (Throwable e) {
			MarvelsLogUtil.getInstance().error("WithholdResultQueryTasklet-execute-->定时代扣结果查询任务异常:",e);
			throw new Exception("WithholdResultQueryTasklet-execute-->定时代扣结果查询任务异常",e);
		}
		return RepeatStatus.FINISHED;
	}
}
